#include<iostream>
#include<regex> 
#include<string>

int main()
{
  std::string _path = "GET /hellowold/login?user=xiaoming&pass=123123 HTTP/1.1";
  std::smatch matches; 
  std::regex e("(GET|HEAD|POST|PUT|DELETE) ([^?]*)(?:\\?(.*))? (HTTP/1\\.[01])(?:\n|\r\n)?",std::regex::icase);
  std::string str;
  bool ret = std::regex_match(_path,matches,e);
  if(ret == false)
  {
    std::cout << "fail" << std::endl;
    return -1; 
  }
  for(int i = 0 ; i < matches.size();i++)
  {
    std::cout << i << ":" << matches[i] << std::endl;
  }
  return 0;
}
